<?php

require_once 'Zend/View/Helper/Abstract.php';

class Core_View_Helper_Cms_RenderModuleScript extends Zend_View_Helper_Abstract
{
    public function renderModuleScript($module, $script, $params = false)
    {
        if (is_array($params)) {
            $this->view->$module = new stdClass();
            $mdl = $this->view->$module;
            foreach ($params as $k => $v) {
                $mdl->$k = $v;
            }
        }
        $this->view->addScriptPath(APPLICATION_PATH . '/modules/' . $module . '/views/scripts/public');
        return $this->view->render($script . '.phtml');
    }
}